package 矩阵问题;

import java.util.Scanner;

public class 矩阵相乘 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int ai = scanner.nextInt();
        int aj = scanner.nextInt();
        int[][] a = new int[ai][aj];
        // 输入a
        for (int i = 0; i < ai; i++) {
            for (int j = 0; j < aj; j++) {
                a[i][j] = scanner.nextInt();
            }
        }
        // 输入b
        int bi = scanner.nextInt();
        int bj = scanner.nextInt();
        int[][] b = new int[bi][bj];
        for (int i = 0; i < bi; i++) {
            for (int j = 0; j < bj; j++) {
                b[i][j] = scanner.nextInt();
            }
        }
        int[][] c= new int[ai][bj];
        // 输入c
        int sum = 0;
        for (int i = 0; i < ai; i++) {
            for (int j = 0; j < bj; j++) {
                for (int k = 0; k < bi; k++) {
                   sum = sum + a[i][k]*b[k][j];
                }
                c[i][j] = sum;
                sum = 0;
            }
        }
        // 输出c
        for (int i = 0; i < ai; i++) {
            for (int j = 0; j < bj; j++) {
                System.out.print(c[i][j]+" ");
            }
            System.out.println();
        }

    }
}
